package day08;

import java.util.Scanner;

public class MathDemo02 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true){
            System.out.println("请输入你的消费金额");
            double price = sc.nextDouble();
            if(price < 0){
                System.out.println("输入的消费金额不合法");
                break;
            }
            price(price);
        }
    }

    // 消费打折
    public static void price(double price){
        if(price < 0){
            System.out.println("消费金额不满足");
            return;
        }
        if(price>=3000){
            price *=0.7;
        }else if(price>=2000){
            price *=0.8;
        }else if(price>=1000){
            price *=0.9;
        }else {
            price *=1.0;
        }
        System.out.println(price);
    }
}
